﻿<%@ Page Language="C#" MasterPageFile="~/member/mMenber.master" AutoEventWireup="true" CodeBehind="newviewpoint.aspx.cs" 
Inherits="map.member.lvyou.newviewpoint" Title="景点" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head2" runat="server">
    <link href="/outstyle.css" rel="stylesheet" type="text/css" />
    <link href="/Stylesheet1.css" rel="stylesheet" type="text/css" />

    <script src="/js/dropdowncontent.js" type="text/javascript"></script>

    <script src="/js/CBScript.js" type="text/javascript"></script>

    <script src="/js/mapiconmaker_packed.js" type="text/javascript"></script>

    <script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=ABQIAAAAA9MjP2TBxqYxBhVpW-OpKRRu9WK7kBr6UgG1CsdYn6QIvNE0PRSz6nmGnZgAI_mC8x2qRC7L3jK29Q"
        type="text/javascript">
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            县:<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
            </asp:DropDownList>
            地区:<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged">
            </asp:DropDownList>
            区域:<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList3_SelectedIndexChanged">
            </asp:DropDownList>
            <br />
            <hr />
            <br />
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="590px"
                DataKeyNames="RECID" CellPadding="4" GridLines="Horizontal" OnRowDeleting="GridView1_RowDeleting"
                OnSelectedIndexChanging="GridView1_SelectedIndexChanging" 
                BorderWidth="3px" BackColor="White" BorderColor="#336666" BorderStyle="Double">
                <RowStyle BackColor="White" ForeColor="#333333" />
                <Columns>
                    <asp:BoundField DataField="RECID" HeaderText="RECID" Visible="False" />
                    <asp:BoundField DataField="lyviewpointid" HeaderText="景点名称">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="taobaolong" HeaderText="经度">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="taobaolat" HeaderText="纬度">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:CommandField ShowSelectButton="True" />
                    <%--  <asp:CommandField ShowDeleteButton="True" />--%>
                </Columns>
                <FooterStyle BackColor="White" ForeColor="#333333" />
                <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
                <EmptyDataTemplate>
                    当前区内没有区域数据,请在下方增加区域.
                </EmptyDataTemplate>
                <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            当前记录ID:
            <asp:Label ID="Label_recid" runat="server" Text="RECID"></asp:Label><br />
            景点名称:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><span class="style5">&nbsp;*</span>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="必须填写项目。"
                ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
            <br />
            &nbsp; 经&nbsp;&nbsp;度 :&nbsp;<asp:TextBox ID="TextBox_long" runat="server" Enabled="False"></asp:TextBox><span
                class="style5">&nbsp;*</span>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="在地图上标记。"
                ControlToValidate="TextBox_long"></asp:RequiredFieldValidator>
            <br />
            &nbsp; 纬&nbsp;&nbsp;度 :&nbsp;<asp:TextBox ID="TextBox_lat" runat="server" Enabled="False"></asp:TextBox><span
                class="style5">&nbsp;*</span>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="在地图上标记。"
                ControlToValidate="TextBox_long"></asp:RequiredFieldValidator><br />
            <asp:Button ID="Button1" runat="server" Text="增加" OnClick="Button1_Click" />
            <asp:Button ID="Button2" runat="server" Text="修改" OnClick="Button2_Click" /><br />
        </ContentTemplate>
    </asp:UpdatePanel>

    <script type="text/javascript">
         var map;
         var geocoder = null;
         function markpos2(zlong, zlat, desc) {
             map.clearOverlays();            
             var point1 = new GLatLng(zlat, zlong);
             var marker1 = new GMarker(point1);

             GEvent.addListener(marker1, "click", function() {
                 marker1.openInfoWindowHtml("标注此位置");
             });
             map.addOverlay(marker1);
             map.setCenter(point1, 14);

         }
         function showAddress(address) {
             if (geocoder) {
                 geocoder.getLatLng(
          address,
          function(point) {
              if (!point) {
                  alert("不能解析: " + address);
              } else {
                  map.setCenter(point, 13);
                  var marker = new GMarker(point);
                  map.addOverlay(marker);
                  marker.openInfoWindowHtml(address);
              }
          }
        );
             }
         }
         function markpos(zlong, zlat, desc) {
             if (GBrowserIsCompatible()) {
                 var mapOptions = {
                     googleBarOptions: {
                         style: "new"
                     }
                 }


                 map = new GMap2(document.getElementById("map_canvas"), mapOptions);


                 map.setMapType(G_NORMAL_MAP);
                 map.addControl(new GMapTypeControl());
                 map.addControl(new GLargeMapControl());
                 map.enableContinuousZoom();
                 map.addControl(new GOverviewMapControl());
                 geocoder = new GClientGeocoder();

                 map.enableGoogleBar();



                 var center = new GLatLng(zlat, zlong);
                 map.setCenter(center, 14);



                 GEvent.addListener(map, "click", function(overlay, latlng) {
                     if (latlng) {
                         var myHtml = "标注此位置";
                         //m.removeOverlay(marker);
                         map.clearOverlays();

                         map.openInfoWindow(latlng, myHtml);
                         var lat = latlng.lat();
                         var lon = latlng.lng();

                         document.getElementById("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder3_TextBox_lat").value = lat;
                         document.getElementById("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder3_TextBox_long").value = lon;
                         var point = new GLatLng(lat, lon);
                         var marker = new GMarker(point);
                         GEvent.addListener(marker, "click", function() {
                             marker.openInfoWindowHtml("标注此位置");
                         });
                         map.addOverlay(marker);
                     }
                 });
             }
         }
    </script>

    单击地图的图标,标注位置:<br />
    <div id="map_canvas" style="width: 100%; height: 360px;">
    </div>
</asp:Content>
